//
//  HomeCollectionReusableViewFooterView.m
//  TravelFollowYourHeart
//
//  Created by 鲁万玺 on 2018/1/4.
//  Copyright © 2018年 Lwx. All rights reserved.
//

#import "HomeCollectionReusableViewFooterView.h"

@interface HomeCollectionReusableViewFooterView()

@property (nonatomic, strong)NSString *url;

@end

@implementation HomeCollectionReusableViewFooterView

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.img.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickImage:)];
    [self.img addGestureRecognizer:tap];
    WS(ws)
    [[HttpRequest shardWebUtil]postNetworkRequestURLString:Url(@"/index/advertisement") andParas:@{} andTransferGottenData:^(id obj, NSError *error) {
        if (error) {
            
        }
        else
        {
            if ([obj[@"code"] integerValue] == 100000)
            {
                [ws.img sd_setImageWithURL:[NSURL URLWithString:obj[@"data"][0][@"pic"]]];
                ws.url = obj[@"data"][0][@"url"];
            }
        }
    }];
}

- (void)clickImage:(UITapGestureRecognizer *)sender
{
//    [[UIViewController getCurrentVC].navigationController pushViewController:nil animated:YES];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.url]];
}

@end
